﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Paihb.aspx.cs" Inherits="RaceList.activity.mhalloween.Paihb" %>

<%--最大的不足，可读性几乎没有了，各种乱写,最好的方式就是这里由前端来控制怎么输出html，后台只需要将数据用json传递到前台即可--%>
<% string paiHangBangUrl = "Relayresult.aspx?" + Parameters.relay + "=";
   int num = Paihangs.Count();

   foreach (Paihang item in Paihangs)
   {
       int index = Paihangs.IndexOf(item) + 1;
       int classNum = 0;
       if (PageNo == 1)
       {
           if (index > 3)
               classNum = 0;
           else
               classNum = index;
       }

       if (UserId == 0)
       { %>
        <div class="nameline" <%= index - 1 == 0 && PageNo == 1 ? "style='margin-top: 60px;'" : "" %>>
            <a href="<%= paiHangBangUrl + item.RelayId %>">
                <div class="num<%= classNum == 0 ? "" : classNum.ToString() %>"><%= index + (PageNo - 1)*PageSize %></div>
                <img src="<%= string.IsNullOrEmpty(item.Headimgurl) ? "images/user.jpg" : item.Headimgurl %>" alt="微信头像">
                <%--<div class="name"><%= item.Nickname.SubHtml(8) %></div>--%>
                <div class="name"><%= item.CreateDate.HasValue ? item.CreateDate.Value.ToString("yy-MM-dd hh:mm") : "" %></div>
                <div class="km"><%= item.SumScore %>m</div>
                <div class="clear"></div>
            </a>
        </div>
    <% }
       else
       { %>
        <div class="nameline" <%= index - 1 == 0 && PageNo == 1 ? "style='margin-top: 60px;'" : "" %>>
            <a href="<%= paiHangBangUrl + item.RelayId %>">
                <div class="num<%= classNum == 0 ? "" : classNum.ToString() %>"><%= index + (PageNo - 1)*PageSize %></div>
                <img src="<%= item.IsGameOver ? "images/yes.png" : "images/no.png" %>" alt="<%= item.IsGameOver ? "已完成" : "未完成" %>">
                <div class="name"><%= item.CreateDate.HasValue ? item.CreateDate.Value.ToString("yy-MM-dd hh:mm") : "" %></div>
                <div class="km"><%= item.SumScore %>m</div>
                <div class="clear"></div>
            </a>
        </div>
    <% } %>
<% } %>
<% if (num == 0)
   { %>
    <div class="nameline">
        <div class="name">到底了!</div>
    </div>
<% } %>
<div class="clear"></div>